<template>
  <div>
    <div>
      <van-search v-model="value" placeholder="请输入搜索关键词" />
    </div>
    <!-- 顶部三个按钮 -->
    <div class="titleBar">
      <!-- 抽屉页面 -->
      <!-- <van-popup v-model="show" :get-container="condition" position="bottom" duration='0.3'/> -->
      <!-- 自己定义一个显示与隐藏的价格盒子 -->
      <div class="tanchu" ref="active2" v-show="show1">
        <div class="top">
          <div class="formGroup">
            <label>帅选</label>
            <input type="number" placeholder="最低价" />
            <div class="line">——</div>
            <input type="number" placeholder="最高价" />
          </div>
          <div class="formGroup">
            <label>排序</label>
            <button>从低到高</button>
            <button>从高到低</button>
          </div>
        </div>
        <div class="bottom">
          <button>取消</button>
          <button>确定</button>
        </div>
      </div>
      <div class="category" v-show="show2">
        <a>全部</a>
        <a>居家生活</a>
        <a>美食酒水</a>
        <a>服饰鞋包</a>
        <a>母婴亲子</a>
        <a>个护清洁</a>
        <a>严选全球</a>
      </div>
      <div class="item">
        <div class="condition active">
          <div class="txt">综合</div>
        </div>
      </div>
      <div class="item" @click="goShow">
        <div class="condition active">
          <div class="txt">价格</div>

          <div class="shangxia">
            <div></div>
            <!-- <img src="./image/shangxiazhankai_o.png" /> -->
          </div>
        </div>
      </div>
      <div class="item" @click="goShow2">
        <div class="condition active">
          <div class="txt">分类</div>
        </div>
      </div>
    </div>
    <!-- 搜索详情页面 -->
    <div class="searchResult">
      <div class="item">
        <img src="./image/RB26.png" />
        <span>哆啦a梦 星座系列车载香熏汽车内饰摆件</span>
        <div class="price">
          <span>￥</span>
          <b>60</b>
          <span>￥</span>
          <s>100</s>
        </div>
        <!-- 特价 -->
        <div class="Special">
          <div class="left">特价</div>
          <div class="right">正在抢购中</div>
        </div>
      </div>
      <div class="item">
        <img src="./image/RB26.png" />
        <span>哆啦a梦 星座系列车载香熏汽车内饰摆件</span>
        <div class="price">
          <span>￥</span>
          <b>60</b>
          <span>￥</span>
          <s>100</s>
        </div>
        <!-- 特价 -->
        <div class="Special">
          <div class="left">特价</div>
          <div class="right">正在抢购中</div>
        </div>
      </div>
      <div class="item">
        <img src="./image/RB26.png" />
        <span>哆啦a梦 星座系列车载香熏汽车内饰摆件</span>
        <div class="price">
          <span>￥</span>
          <b>60</b>
          <span>￥</span>
          <s>100</s>
        </div>
        <!-- 特价 -->
        <div class="Special">
          <div class="left">特价</div>
          <div class="right">正在抢购中</div>
        </div>
      </div>
      <div class="item">
        <img src="./image/RB26.png" />
        <span>哆啦a梦 星座系列车载香熏汽车内饰摆件</span>
        <div class="price">
          <span>￥</span>
          <b>60</b>
          <span>￥</span>
          <s>100</s>
        </div>
        <!-- 特价 -->
        <div class="Special">
          <div class="left">特价</div>
          <div class="right">正在抢购中</div>
        </div>
      </div>
      <div class="item">
        <img src="./image/RB26.png" />
        <span>哆啦a梦 星座系列车载香熏汽车内饰摆件</span>
        <div class="price">
          <span>￥</span>
          <b>60</b>
          <span>￥</span>
          <s>100</s>
        </div>
        <!-- 特价 -->
        <div class="Special">
          <div class="left">特价</div>
          <div class="right">正在抢购中</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 这个是搜索的value值
      value: "",
      // 定义是否弹出框
      show1: false,
      // 定义分类的是否弹出
      show2: false,
    };
  },
  methods: {
    // 价格盒子显示与隐藏
    goShow() {
      console.log(123);
      this.show1 = !this.show1;
    },
    goShow2() {
      this.show2 = !this.show2;
    },
  },
};

// 返回一个特定的 DOM 节点，作为挂载的父节点
//  绑定第中间弹出框
// condition() {
//   return document.querySelector(".my-container");
// },

// 弹出中间的弹出框
/*   goShow() {
       
    }, */
</script>

<style lang="less" scoped>
.titleBar {
  width: 100%;
  height: 0.8rem;
  background-color: red;
  box-sizing: border-box;
  color: #333;
  display: flex;
  position: relative;
  .tanchu {
    position: absolute;
    top: 30px;
    width: 100%;
    height: 4.1067rem;
    background-color: yellowgreen;
    display: block;
    z-index: 6;
    .top {
      width: 100%;
      height: 2.8291rem;
      background-color: orange;
      display: flex;
      flex-wrap: wrap;
      .formGroup {
        flex: 1;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        margin-top: 18px;
        color: #333;
        font-size: 0.28rem;
        margin-left: 13px;
        label {
          width: 25.6px;
          height: 0.56rem;
          line-height: 0.56rem;
          text-align: center;
          margin-right: 0.24rem;
          color: #333;
        }
        input {
          width: 123.48px;
          height: 25.6px;
          text-align: center;
        }
        line {
          margin: 0 0.22rem;
          height: 25.6px;
          line-height: 25.6px;
        }
        button {
          margin-right: 0.24rem;
          width: 2.08rem;
          height: 25.6px;
          text-align: center;
          background-color: #fff;
          border: 1px solid #7f7f7f;
          border-radius: 0.04rem;
          font-size: 0.28rem;
          line-height: 0.56rem;
        }
      }
    }
    .bottom {
      height: 47.46px;
      width: 100%;
      display: flex;
      button {
        flex: 1;
      }
    }
  }
  .category {
    position: absolute;
    background-color: pink;
    width: 100%;
    z-index: 6;
    top: 30px;
    height: 4.1067rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 0.4rem 0.65rem;
    align-items: center;
    a {
      border: 1px solid black;
      margin-right: 0.4rem;
      margin-bottom: 0.4rem;
      padding: 0 0.18rem;
      line-height: 0.54rem;
      letter-spacing: 0;
      border: 0.01rem solid #7f7f7f;
      border-radius: 0.04rem;
      color: #333;
      font-size: 20px;
    }
  }
  .item {
    flex: 1;
    line-height: 0.8rem;
    font-size: 0.28rem;
    background-color: white;
  }
}
.searchResult {
  width: 100%;
  height: calc(100vh-77.04px);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;

  .item {
    padding: 0.2rem;
    background-color: #bbb;
    width: 44.5%;
    height: 6.0267rem;
    border-radius: 0.16rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    img {
      height: 3.45rem;
      width: 100%;
    }
    span {
      font-size: 16px;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      text-align: left;
    }
    .price {
      width: 2.6933rem;
      height: 0.72rem;
      text-align: left;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      s {
        width: 0.3467rem;
        height: 0.3467rem;
        font-size: 0.3467rem;
      }
      :nth-child(3) {
        font-size: 0.3467rem;
      }
      :nth-child(1) {
        color: rgb(250, 30, 50);
      }
      :nth-child(2) {
        color: rgb(250, 30, 50);
      }
    }
    .Special {
      display: flex;
      flex-wrap: nowrap;
      width: 100%;
      height: 0.5624rem;
      background-color: #ffe9eb;
      .left {
        padding: 0 5px;
        font-size: 0.4rem;
        background-color: #fa1e32;
        border-radius: 0.64rem;
      }
      .right {
        font-size: 0.4rem;
        margin-left: 0.1067rem;
        font-weight: bold;
        color: #fa1e32;
      }
    }
  }
}
</style>
